﻿namespace DMSystem_Sqlite_WebAPI.Modals
{
    /// <summary>
    /// 统一接口响应模型
    /// {
    ///"code": 200,
    ///"message": "操作成功",
    ///"data": "点确定开始压缩csv监控"
    ///}
    /// </summary>
    public class ApiResponse
    {
        public int Code { get; set; }
        public string? Message { get; set; }
        public object? Data { get; set; }

        public static ApiResponse Success(object? data = null, string message = "操作成功") =>
            new() { Code = 200, Message = message, Data = data };

        public static ApiResponse Fail(string message = "操作失败", object? data = null) =>
            new() { Code = 500, Message = message, Data = data };
    }
}
